<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>
<script language="javascript" src="${basePath }commonJs/tags/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" src="${basePath }commonJs/quinn_commons.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	reprotTitle();
	$("#exportBtn").click(function() {
		$.messager.confirm('提示', '确定要导出吗？', function(r) {
			if (r) {
				 if($("#sum1").val() != "" && typeof($("#sum1").val()) != "undefined"){
					 $("#cSum1").val(Number($("#sum1").val()));
				 }
				if($("#sum2").val() != "" && typeof($("#sum1").val()) != "undefined"){
					$("#cSum2").val(Number($("#sum2").val()));
				}
				if($("#sum3").val() != "" && typeof($("#sum1").val()) != "undefined"){
					$("#cSum3").val(Number($("#sum3").val()));
				}
				if($("#sum4").val() != "" && typeof($("#sum1").val()) != "undefined"){
					$("#cSum4").val(Number($("#sum4").val())); 
				}
				$("#exportTime").val($("#searchTime").val());
				$("#exportForm").submit();
			}
		});
	});
	
	$("#searchBtn").click(function() {
		$("#searchForm").submit();
	});
});

function reprotTitle(){
	var time = $("#searchTime").val().replace('/','.');
	$("#reportTitle").html('<b>'+time+' 日常收益统计</b>');
}
function go() {
	window.location.href = "${basePath}report/jump.shtml?key=" + $("#report_type").val();
}
</script>
<title>Insert title here</title>
</head>
<body class="bg">

<div class="content m_auto">
	<%@include file="reprot_tab.jsp"%>
    <div class="content_r mt10">
    <div class="tab_normal m10">
    <div class="file_single_dl f14 fixed">
			<br />
			<form action="${basePath}report/jump.shtml" method="get" id="searchForm" name="searchForm">
			<dl style="overflow:hidden" class="fixed">
				<dd>
					<label>报表类型：</label>
					<div class="uboxstyle">
						<select name="reportName" id="report_type" onchange="go()">
							<option value="dailyIncome" selected = "selected">日常收益报表</option>
							<option value="membershipSale">会籍销售统计报表</option>
							<option value="membership">会籍统计报表</option>
							<option value="partyOrGroup">派对团体统计报表</option>
							<option value="scmCount">进场人数统计报表</option>
							<option value="membershipProfit">会籍利润报表</option>
							<option value="membershipValue">会员储值报表</option>
							<option value="partyPrepaid">派对预付报表</option>
							<option value="failureMember">会员失效报表</option>
						</select>
					</div>
				</dd>
				<dd><label>日期：</label>
					<input type="text" readonly="readonly" class="Wdate iput_t w82" onclick="WdatePicker({dateFmt:'yyyy.MM.dd ',isShowWeek:true,isShowClear:true,readOnly:true})" id="searchTime" name="searchTime" title="" value="${reportParam.searchTime }"/>
				</dd>
			</dl>
			</form>
            <div>
            	<input type="button" id="searchBtn" class="btn fr m010" value="查询" onclick="select11();" />
            	<form action="${basePath}report/export.shtml" method="post" id="exportForm" name="exportForm">
            		<input type="hidden" name="reportName" value="dailyIncome"/>
            		<input type="hidden" name="searchTime" id="exportTime" />
            		<input type="hidden" name="sum1" id="cSum1" value="0"/>
            		<input type="hidden" name="sum2" id="cSum2" value="0"/>
            		<input type="hidden" name="sum3" id="cSum3" value="0"/>
            		<input type="hidden" name="sum4"  id="cSum4" value="0"/>
            		<input type="button" id="exportBtn" class="btn fr m010"  value="导出" />
            	</form>
             </div>
		</div>
		<br />
    	
    <br />
    		<div id="reportTitle" style="text-align:center;font-size:18px"></div><br />
			<div style="text-align:center;font-size:12px;font-weight:blod;"><b>统计时间：${countedTime} 统计人：${countedUser }</b></div><br />
			<table class="table" id="table1">
				<tr>
					<th width="147" rowspan="2">项目</th>
					<th rowspan="2">产品</th>
					<th rowspan="2">详情</th>
					<th colspan="2">日收益</th>
					<th colspan="2">月收益</th>
				</tr>
				<tr>
					<th>数量</th>
					<th>RMB</th>
					<th>数量</th>
					<th>RMB</th>
				</tr>
				<!-- 会籍 -->
				<c:if test="${reportParam.memSize>0 }">
					<c:set var="flag" value="1"></c:set>
					<c:forEach items="${reportParam.memMap }" var="memList" varStatus="i">
						<c:forEach items="${memList.value }" var="mem" varStatus="j">
							<c:set var="sumMem1" value="${sumMem1+ mem.dayCount}"></c:set>
							<c:set var="sumMem2" value="${sumMem2+ mem.dayDues}"></c:set>
							<c:set var="sumMem3" value="${sumMem3+ mem.monthCount}"></c:set>
							<c:set var="sumMem4" value="${sumMem4+ mem.monthDues}"></c:set>
							<tr>
								<c:if test="${i.index == 0 && j.index == 0 }">
									<td rowspan="${reportParam.memSize+1 }">会籍</td>
								</c:if>
								<c:if test="${j.index == 0 }">
									<td rowspan="${memList.value.size() }">${memList.key }</td>
								</c:if>
								<td>${mem.name }</td>
								<td>${mem.dayCount }</td>
								<td>${mem.dayDues }</td>
								<td>${mem.monthCount }</td>
								<td>${mem.monthDues }</td>
							</tr>
						</c:forEach>
					</c:forEach>
					<tr>
						<td>小计</td>
						<td></td>
						<td>${sumMem1 }</td>
						<td>${sumMem2 }</td>
						<td>${sumMem3 }</td>
						<td>${sumMem4 }</td>
					</tr>					
				</c:if>
				<!-- 售票 -->
				<c:if test="${reportParam.ticketList.size()>0 }">
					<c:set var="flag" value="1"></c:set>
					<c:forEach items="${reportParam.ticketList }" var="ticket" varStatus="i">
						<c:set var="sumTicket1" value="${sumTicket1+ ticket.dayCount}"></c:set>
						<c:set var="sumTicket2" value="${sumTicket2+ ticket.dayDues}"></c:set>
						<c:set var="sumTicket3" value="${sumTicket3+ ticket.monthCount}"></c:set>
						<c:set var="sumTicket4" value="${sumTicket4+ ticket.monthDues}"></c:set>
						<tr>
						<c:if test="${i.index == 0}">
							<td rowspan="${reportParam.ticketList.size()+1 }">售票</td>
						</c:if>
							<td>${ticket.name }</td>
							<td></td>
							<td>${ticket.dayCount }</td>
							<td>${ticket.dayDues }</td>
							<td>${ticket.monthCount }</td>
							<td>${ticket.monthDues }</td>
						</tr>
					</c:forEach>
					<tr>
						<td>小计</td>
						<td></td>
						<td>${sumTicket1 }</td>
						<td>${sumTicket2 }</td>
						<td>${sumTicket3 }</td>
						<td>${sumTicket4 }</td>
					</tr>
				</c:if>
				<!-- 派对团体 -->
				<c:if test="${reportParam.pgSize>0 }">
					<c:set var="flag" value="1"></c:set>
					<c:forEach items="${reportParam.pgMap }" var="pgList" varStatus="i">
						<c:forEach items="${pgList.value }" var="pg" varStatus="j">
							<c:set var="sumPG1" value="${sumPG1+ pg.dayCount}"></c:set>
							<c:set var="sumPG2" value="${sumPG2+ pg.dayDues}"></c:set>
							<c:set var="sumPG3" value="${sumPG3+ pg.monthCount}"></c:set>
							<c:set var="sumPG4" value="${sumPG4+ pg.monthDues}"></c:set>
							<tr>
								<c:if test="${i.index == 0 && j.index == 0 }">
									<td rowspan="${reportParam.pgSize+1 }">派对团体</td>
								</c:if>
								<c:if test="${j.index == 0 }">
									<td rowspan="${pgList.value.size() }">${pgList.key }</td>
								</c:if>
								<td>${pg.name }</td>
								<td>${pg.dayCount }</td>
								<td>${pg.dayDues }</td>
								<td>${pg.monthCount }</td>
								<td>${pg.monthDues }</td>
							</tr>
						</c:forEach>
					</c:forEach>
					<tr>
						<td>小计</td>
						<td></td>
						<td>${sumPG1 }</td>
						<td>${sumPG2 }</td>
						<td>${sumPG3 }</td>
						<td>${sumPG4 }</td>
					</tr>
				</c:if>
				<!-- 课程 -->
				<c:if test="${reportParam.courseList.size()>0 }">
					<c:set var="flag" value="1"></c:set>
					<c:forEach items="${reportParam.courseList }" var="course" varStatus="i">
						<c:set var="sumCourse1" value="${sumCourse1+ course.dayCount}"></c:set>
						<c:set var="sumCourse2" value="${sumCourse2+ course.dayDues}"></c:set>
						<c:set var="sumCourse3" value="${sumCourse3+ course.monthCount}"></c:set>
						<c:set var="sumCourse4" value="${sumCourse4+ course.monthDues}"></c:set>
						<tr>
						<c:if test="${i.index == 0}">
							<td rowspan="${reportParam.courseList.size()+1 }">课程</td>
						</c:if>
							<td>${course.name }</td>
							<td></td>
							<td>${course.dayCount }</td>
							<td>${course.dayDues }</td>
							<td>${course.monthCount }</td>
							<td>${course.monthDues }</td>
						</tr>
					</c:forEach>
					<tr>
						<td>小计</td>
						<td></td>
						<td>${sumCourse1 }</td>
						<td>${sumCourse2 }</td>
						<td>${sumCourse3 }</td>
						<td>${sumCourse4 }</td>
					</tr>
				</c:if>
				<!-- 普通商品 -->
				<c:if test="${reportParam.goodsList.size()>0 }">
					<c:set var="flag" value="1"></c:set>
					<c:forEach items="${reportParam.goodsList }" var="goods" varStatus="i">
						<c:set var="sumGoods1" value="${sumGoods1+ goods.dayCount}"></c:set>
						<c:set var="sumGoods2" value="${sumGoods2+ goods.dayDues}"></c:set>
						<c:set var="sumGoods3" value="${sumGoods3+ goods.monthCount}"></c:set>
						<c:set var="sumGoods4" value="${sumGoods4+ goods.monthDues}"></c:set>
						<tr>
						<c:if test="${i.index == 0}">
							<td rowspan="${reportParam.goodsList.size()+1 }">普通商品</td>
						</c:if>
							<td>${goods.name }</td>
							<td></td>
							<td>${goods.dayCount }</td>
							<td>${goods.dayDues }</td>
							<td>${goods.monthCount }</td>
							<td>${goods.monthDues }</td>
						</tr>
					</c:forEach>
					<tr>
						<td>小计</td>
						<td></td>
						<td>${sumGoods1 }</td>
						<td>${sumGoods2 }</td>
						<td>${sumGoods3 }</td>
						<td>${sumGoods4 }</td>
					</tr>
				</c:if>
				<!-- 其他-->
				<c:if test="${reportParam.otherList.size()>0 }">
					<c:set var="flag" value="1"></c:set>
					<c:forEach items="${reportParam.otherList }" var="other" varStatus="i">
						<c:set var="sumOther1" value="${sumOther1+ other.dayCount}"></c:set>
						<c:set var="sumOther2" value="${sumOther2+ other.dayDues}"></c:set>
						<c:set var="sumOther3" value="${sumOther3+ other.monthCount}"></c:set>
						<c:set var="sumOther4" value="${sumOther4+ other.monthDues}"></c:set>
						<tr>
						<c:if test="${i.index == 0}">
							<td rowspan="${reportParam.otherList.size()+1 }">其他</td>
						</c:if>
							<td>${other.name }</td>
							<td></td>
							<td>${other.dayCount }</td>
							<td>${other.dayDues }</td>
							<td>${other.monthCount }</td>
							<td>${other.monthDues }</td>
						</tr>
					</c:forEach>
					<tr>
						<td>小计</td>
						<td></td>
						<td>${sumOther1 }</td>
						<td>${sumOther2 }</td>
						<td>${sumOther3 }</td>
						<td>${sumOther4 }</td>
					</tr>
				</c:if>
				<c:if test="${flag == '1' }">
					<tr>
						<td>合计</td>
						<td></td>
						<td></td>
						<td>${sumMem1+sumTicket1+sumPG1+sumCourse1+sumGoods1+sumOther1 }</td>
						<td>${sumMem2+sumTicket2+sumPG2+sumCourse2+sumGoods2+sumOther2 }</td>
						<td>${sumMem3+sumTicket3+sumPG3+sumCourse3+sumGoods3+sumOther3 }</td>
						<td>${sumMem4+sumTicket4+sumPG4+sumCourse4+sumGoods4+sumOther4 }</td>
					</tr>
					<input type="hidden" id="sum1" value="${sumMem1+sumTicket1+sumPG1+sumCourse1+sumGoods1+sumOther1 }" />
        			<input type="hidden" id="sum2" value="${sumMem2+sumTicket2+sumPG2+sumCourse2+sumGoods2+sumOther2 }" />
        			<input type="hidden" id="sum3" value="${sumMem3+sumTicket3+sumPG3+sumCourse3+sumGoods3+sumOther3 }" />
        			<input type="hidden" id="sum4" value="${sumMem4+sumTicket4+sumPG4+sumCourse4+sumGoods4+sumOther4 }" />
				</c:if>
			</table>
			</div>
</div>
</div>
</body>
</html>